<template>
	<view class="wf-box" :style="{ paddingTop: totalheight }">
		<view class="head" :style="{ paddingTop: navBarHeight }">
			<view class="head-np">
				<view class="back" @click="back()">
					<image src="../../static/img/me-43.png"></image>
				</view>
				<view class="title">我的名片</view>
				<view></view>
			</view>
		</view>
		
		<view class="main">
			<view class="ewm">
				<!-- <image :src="meText"></image> -->
				
				<l-painter css="width: 400rpx; height: 720rpx; ">
					<l-painter-view css="width: 100%; height: 400rpx;">
						<l-painter-image :src="meText" css="width: 400rpx; height: 400rpx;"></l-painter-image>
					</l-painter-view>
					
					<l-painter-view css="margin-top: 40rpx; text-align: center;">
						<l-painter-text text="扫描上方的二维码，加我为好友" css="font-size: 28rpx; color: #fff;"></l-painter-text>
					</l-painter-view>
				</l-painter>
			</view>
		</view>
	</view>
</template>

<script>
	// import { QRCodeScanner } from '@/components/QRCodeScanner'
	import { getQRCodeApi } from "@/api/api.js"
	import navBarMixin from '@/mixin/navBarMixin.js'
	export default {
		data() {
			return {
				meText: ''
			}
		},
		mixins: [navBarMixin],
		methods: {
			back() {
				uni.navigateBack()
			},
			
			async getMeEwm() {
				const res = await getQRCodeApi()
				if(!res.code) {
					// console.log('res.data===',res.data)
					this.meText = "data:image/png;base64," + res.data
					// this.meText = res.data
				}
				
			}
		},
		onLoad() {
			this.getMeEwm()
		}
	}
</script>

<style lang="scss" scoped>
	.wf-box {
		min-height: 100vh;
		background: url('../../static/img/contact-04.png') no-repeat;
		background-size: 100% 100%;
		.head {
			position: fixed;
			top: 0;
			height: 48px;
			z-index: 1;
			width: 100%;
			background: transparent;
		
			.head-np {
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				height: 100%;
				padding: 0 30rpx;
				box-sizing: border-box;
		
				.back {
					image {
						width: 20rpx;
						height: 37rpx;
					}
				}
		
				.title {
					font-size: 36rpx;
					font-weight: bold;
					color: #fff;
				}
			}
		}
		
		.main {
			width: 400rpx;
			min-height: 300rpx;
			margin: 0 auto;
			margin-top: 100rpx;
			
			.ewm {
				width: 400rpx;
				height: 400rpx;
				// border: 2rpx solid red;
				margin: 0 auto;
				
				image {
					display: block;
					width: 400rpx;
					height: 400rpx;
					margin: 0 auto;
				}
			}
		}
	}
</style>